package com.sbtr.business.feature.service.impl;

import cn.hutool.core.bean.BeanUtil;
import com.sbtr.business.feature.entity.FeMissingRule;
import com.sbtr.business.feature.dto.FeMissingRuleDto;

import com.sbtr.business.feature.service.FeMissingRuleService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.sbtr.business.feature.mapper.FeMissingRuleMapper;
import org.springframework.stereotype.Service;
import org.springframework.beans.factory.annotation.Autowired;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.core.conditions.AbstractWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.sbtr.common.PageDto;
import com.sbtr.util.PageDtoUtils;
import org.springframework.transaction.annotation.Transactional;

/**
 * 缺失值处理字段列表 Service接口实现类
 *
 * @author dgl
 * @since  2023-03-17
 */
@Transactional
@Service
public class FeMissingRuleServiceImpl extends ServiceImpl<FeMissingRuleMapper,FeMissingRule> implements FeMissingRuleService {

    @Autowired
    FeMissingRuleMapper feMissingRuleMapper;

    @Override
    public PageDto<FeMissingRule> pageList(FeMissingRuleDto feMissingRuleDto) {

        IPage<FeMissingRule> page = new Page<>();
        page.setSize(feMissingRuleDto.getPageSize());
        page.setCurrent(feMissingRuleDto.getPage());
        page = feMissingRuleMapper.selectPages(page, BeanUtil.beanToMap(feMissingRuleDto));
        PageDto<FeMissingRule> r = PageDtoUtils.getPageDtoByIPage(page, FeMissingRule.class);

        return r;
    }
}

